// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store/index.js'
import {ToastPlugin,LoadingPlugin} from "vux";
Vue.use(ToastPlugin);
Vue.use(LoadingPlugin);

Vue.config.productionTip = false;

Vue.filter("currency",function(num){
  if(num){
    return "￥"+Math.round(num);
  }
});

Vue.filter("money",function(num){
  if(num){
    return "￥"+num.toFixed(2);
  }
  
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App },
  created(){
    this.$vux.loading.show({text:'Loading'});
  },
  mounted(){
    this.$vux.loading.hide();
  }
})

// 当窗口大小改变时，重新根据窗口设置rem的大小
function resetREM(){
  var w = window.innerWidth;
  var size = w/360;
  document.documentElement.style.fontSize = size+"px";
}

resetREM();
window.onresize = resetREM;
window.onorientationchange = resetREM;

